Skip to content

Conversation

@gregory-at-cvs
Copy link

@gregory-at-cvs gregory-at-cvs commented Nov 22, 2025

PR #3: Session Telemetry Integration

Description

Integrates session identifiers across all telemetry instrumentation modules,
using the infrastructure established in PR #2.

This PR adds session IDs to:

Instrumentation Coverage

  • ANR (Application Not Responding) - Session context for app freezes
  • Crash reporting - Link crashes to user sessions
  • View clicks - Track user interactions per session
  • Compose clicks - Session context for Jetpack Compose UI
  • Network changes - Correlate connectivity with sessions
  • WebSocket events - Session tracking for real-time connections
  • Slow rendering / jank - Performance issues per session
  • App startup events - Session initialization tracking

Integration Points

  • SessionIdSpanAppender - Automatically adds session IDs to all spans
  • SessionIdLogRecordAppender - Automatically adds session IDs to all log records
  • Factory Pattern - SessionProviderFactory and SessionManagerFactory
  • Configuration DSL - Easy session configuration in OpenTelemetryRumInitializer

Example Usage

OpenTelemetryRumInitializer.initialize(context) {
    session {
        // Session expires after 15 minutes in background (default)
        backgroundInactivityTimeout = 15.minutes

        // Session expires after 4 hours regardless of activity (default)
        maxLifetime = 4.hours
    }
}

Result: All telemetry data now includes session context (session.id and session.previous_id) for comprehensive session-based observability.

@gregory-at-cvs gregory-at-cvs requested a review from a team as a code owner November 22, 2025 05:01
@gregory-at-cvs gregory-at-cvs force-pushed the feat/session-telemetry-integration branch 4 times, most recently from f25f144 to ff7dc0f Compare November 22, 2025 07:28
@codecov
Copy link

codecov bot commented Nov 22, 2025

Codecov Report

❌ Patch coverage is 94.16667% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.17%. Comparing base (7e5a63e) to head (d041dee).

Files with missing lines Patch % Lines
..._0/websocket/internal/WebsocketEventGenerator.java 0.00% 3 Missing ⚠️
...metry/android/agent/OpenTelemetryRumInitializer.kt 83.33% 1 Missing and 1 partial ⚠️
.../io/opentelemetry/android/ktx/SessionExtensions.kt 94.44% 0 Missing and 1 partial ⚠️
...instrumentation/startup/SdkInitializationEvents.kt 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1421      +/-   ##
==========================================
+ Coverage   63.65%   64.17%   +0.51%     
==========================================
  Files         159      163       +4     
  Lines        3134     3207      +73     
  Branches      326      330       +4     
==========================================
+ Hits         1995     2058      +63     
- Misses       1042     1048       +6     
- Partials       97      101       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gregory-at-cvs gregory-at-cvs force-pushed the feat/session-telemetry-integration branch 2 times, most recently from 7e60b79 to 2ac74e3 Compare November 22, 2025 19:52
- Integrate SessionProvider with all instrumentation modules
- Add session ID propagation to spans, logs, and metrics
- Configure session management in OpenTelemetryRumInitializer
- Add session lifecycle observers across instrumentation
- Add demo-app support for session management with core dependency
- Add Kotlin extension functions for easy session ID injection
- Include high-contrast diagrams for PR documentation
@gregory-at-cvs gregory-at-cvs force-pushed the feat/session-telemetry-integration branch from 2ac74e3 to d041dee Compare November 22, 2025 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant